import request from '@/utils/request'

/**
 * 获取企业列表 
 * @param {*} params  参数
 * @returns 
 */
export function getEnterpriseListAPI(params) {
    return request({
        url: '/park/enterprise',
        method: 'get',
        params
    })
}

export function getIndustryListApi() {
    return request({
        url: '/park/industry'
    })

}


/**
 * 添加企业
 * @param {*} data 参数 
 * @returns 
 */
export function addEnterpriseAPI(data) {
    return request({
        url: '/park/enterprise',
        method: 'post',
        data
    })
}

// 根据id获取数据，回显数据
export function getEnterpriseDetailAPI(id) {
    return request({
        url: `/park/enterprise/${id}`
    })
}

/**
 * 更新企业
 * @param {*} data
 * @returns
 */
export function updateExterpriseAPI(data) {
    return request({
        url: '/park/enterprise',
        method: 'PUT',
        data
    })
}

/**
 * 删除企业
 * @param {*} id 参数 
 * @returns 
 */
export function deleteEnterpriseAPI(id) {
    return request({
        url: `/park/enterprise/${id}`,
        method: 'delete'
    })
}


/**
 * 获取可租赁的楼宇
 * @returns 
 */
export function getRentBuildingAPI() {
    return request({
        url: '/park/rent/building'
    })
}

/**
 * 添加租赁合同
 * @param {*} data 
 * @returns 
 */
export function addRentAPI(data){
    return request({
      url:'park/enterprise/rent',
      method:'post',
      data
    })
}

/**
 * 获取展示的企业合同
 * @returns 
 */
export function getEnterpriseRentBuildingAPI(id){
    return request({
        url:`/park/enterprise/rent/${id}`
    })
}


export function rentingOutAPI(id){
   return request({
    url:`/park/enterprise/rent/${id}`,
    method:'put'
   })
}